<!--
  * 商品明细
  *
-->
<template>
  <div>
    <a-table :dataSource="tableData" :columns="columns" :pagination="false" rowKey="id" size="small" bordered />
  </div>
</template>
<script setup lang="ts">
import { reactive, ref, watch } from 'vue'

const props = defineProps({
  enterpriseId: {
    type: Number,
    default: null
  }
})

const columns = reactive([
  {
    title: '商品名称',
    dataIndex: ['goods', 'goods_name']
  },
  {
    title: '规格',
    dataIndex: ['spec', 'spec_name']
  },
  {
    title: '单位',
    dataIndex: ['spec', 'unit_name']
  },
  {
    title: '配送数量',
    dataIndex: 'num'
  },
  {
    title: '签收数量',
    dataIndex: 'received_number'
  },
  {
    title: '配送金额',
    dataIndex: 'real_price'
  },
  {
    title: '备注',
    dataIndex: 'remark'
  }
])
const tableData = ref([])

watch(
  () => props.enterpriseId,
  (e) => {
    if (e) {
      tableData.value = e
    }
  },
  { immediate: true }
)
</script>
